const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    columns: ['杭州', '宁波', '温州', '嘉兴', '湖州'],
    name:'xu4a5rhj',
    active: 0,
    icon: {
      active: 'https://m.bjclb.cn/assets/classroom/tab1.png',
      normal: 'https://m.bjclb.cn/assets/classroom/tab1_.png',
    },
    icon2: {
      active: 'https://m.bjclb.cn/assets/classroom/tab2.png',
      normal: 'https://m.bjclb.cn/assets/classroom/tab2_.png',
    },
    icon3: {
      active: 'https://m.bjclb.cn/assets/classroom/tab3.png',
      normal: 'https://m.bjclb.cn/assets/classroom/tab3_.png',
    },
    statusBarHeight: app.globalData.statusBarHeight,
    navBarHeight: app.globalData.navBarHeight,
    fixedScrollTop:false,
    show:false
  },
  index(){
    wx.switchTab({
      url: '/pages/homeview/homeview',
    })
  },
  classroomOnly(){
    wx.navigateTo({
      url: '../../pages/classroomOnly/classroomOnly',
    })
  },
  classroomDevice(){
    wx.navigateTo({
      url: '../../pages/classroomDevice/classroomDevice',
    })
  },
  notification(){
    this.setData({show:true})
  },
  onCancel() {
    this.setData({show:false })
  },
  onScroll: function(e) {
    // e.detail.scrollTop 就是当前的滚动距离
    console.log(e.detail.scrollTop);
  },
  //获取下拉距离
  onPageScroll: function (res) {
    console.log(res);
    let that = this
    let scrollTop = res.scrollTop
    that.setData({
        scrollTop
    })
    if (scrollTop >= 60) {
      that.setData({
        fixedScrollTop: true
      })
    } else {
      that.setData({
        fixedScrollTop: false
      })
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },
  menu(e){
    wx.redirectTo({
      url: e.currentTarget.dataset.path,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})